package org.boulderfoodrescue.webapp.shared;

import java.io.Serializable;

public class UserAccountDetails implements Serializable{
	private static final long serialVersionUID = -3777754988119484534L;
	private Long databaseKey;
	
	private String email;
	private String firstName;
	private String lastName;
	/**
	 * The level of access granted to the user
	 * 0 = public
	 * 1 = volunteer
	 * 2 = admin
	 */
	public enum AccessLevel{Public, Volunteer, Admin};
	private AccessLevel accessLevel;

	public UserAccountDetails(){
		email = "";
		firstName = "";
		lastName = "";
		accessLevel = AccessLevel.Public;
	}

	public Long getDatabaseKey() {
		return databaseKey;
	}

	public void setDatabaseKey(Long databaseKey) {
		this.databaseKey = databaseKey;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getDisplayName()
	{
		return firstName + " " + lastName;
	}
	
	public AccessLevel getAccessLevel() {
		return accessLevel;
	}

	public void setAccessLevel(AccessLevel accessLevel) {
		this.accessLevel = accessLevel;
	}

	public Long getAccessLevelasLong() {
		switch(accessLevel)
		{
		case Public: return 0l;
		case Volunteer: return 1l;
		case Admin: return 2l;
		}
		return 0l;
	}

	public void setAccessLevelasLong(Long accessLevel) {
		switch(accessLevel.intValue())
		{
		case 0: this.accessLevel = AccessLevel.Public;break;
		case 1: this.accessLevel = AccessLevel.Volunteer;break;
		case 2: this.accessLevel = AccessLevel.Admin;break;
		}
	}
}
